
def info():
    import psutil
    import shutil
    mem = psutil.virtual_memory()
    # 系统总计内存(单位字节)
    zj = float(mem.total>>20)/1024
    # 系统已经使用内存(单位字节)
    ysy = float(mem.used>>20)/1024
    # 系统空闲内存(单位字节)
    kx = float(mem.free>>20)/1024

    total, used, free = shutil.disk_usage("/")
    print("Memo:%.2f / %.2f GB\nDisk:%d  / %d GB"%(ysy,zj,used>>30,  total>>30))
info()
# 1431
def gendataset(labels=["sunshade","awning","fixed_awning","others"]):
    import glob,os
    os.system("mkdir -p dataset/data")
    img_ps=glob.glob("/home/data/1395/*.xml")
    pre_len=len("/home/data/")
    f=open("/home/data/train.txt",mode="w")
    fv=open("/home/data/valid.txt",mode="w")
    flabel=open("/home/data/label_list.txt",mode="w")
    for l in labels:
        flabel.write(f"{l}\n")
    cnnt=0
    for im_p in img_ps:
        img_n=im_p[pre_len:-3]+"jpg"
        xml_n=im_p[pre_len:-3]+"xml"
        # print(img_n,xml_n)
        # if cnnt%3==0:
        fv.write(f"{img_n} {xml_n}\n")
        # else:
        f.write(f"{img_n} {xml_n}\n")
        cnnt+=1
    f.close()
    flabel.close()
    fv.close()
gendataset(["electric_scooter","person","bicycle","others"])